//
//  BookClassHeader.m
//  LiteraryTune
//
//  Created by Mr.Xy on 2018/11/24.
//  Copyright © 2018 cxd. All rights reserved.
//

#import "BookClassHeader.h"

@implementation BookClassHeader
{
    UILabel *_className;
    UIButton *_moreBtn;
}

- (void)setClassTitle:(NSString *)classTitle {
    _classTitle = classTitle;
    _className.text = classTitle;
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self setupUI];
    }
    return self;
}

- (void)setupUI {
    
    _className = [[UILabel alloc] init];
    _className.textColor = [UIColor colorFromHexCode:@"#666666"];
    _className.font = [UIFont systemFontOfSize:13];
    [self addSubview:_className];
    
    _moreBtn = [[UIButton alloc] init];
    [_moreBtn setTitle:@"更多" forState:UIControlStateNormal];
    [_moreBtn setTitleColor:[UIColor colorFromHexCode:@"666666"] forState:UIControlStateNormal];
    _moreBtn.titleLabel.font = [UIFont systemFontOfSize:13];
    [_moreBtn addTarget:self action:@selector(moreBtnDidClick:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:_moreBtn];
}

- (void)moreBtnDidClick:(UIButton *)sender {
    
    if ([self.delegate respondsToSelector:@selector(bookClassHeader:moreBtnDidClick:)]) {
        [self.delegate bookClassHeader:self moreBtnDidClick:sender];
    }
}

@end
